import request from '@/utils/request'
import type {
  TrademarkListResponseType,
  Record,
  AddTrademarkResponseType,
  UpdateTrademarkResponseType,
  DeleteTrademarkResponseType,
} from './types'

enum API {
  TRADEMARK_URL = '/admin/product/baseTrademark',
  ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
  UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
  DELETETRADEMARK_URL = '/admin/product/baseTrademark/remove',
}

//请求品牌列表
export const reqTrademarkList = (page: number, limit: number) =>
  request.get<any, TrademarkListResponseType>(
    API.TRADEMARK_URL + `/${page}/${limit}`,
  )
//新增品牌
export const reqAddTrademark = (object: Record) =>
  request.post<any, AddTrademarkResponseType>(API.ADDTRADEMARK_URL, object)
//修改品牌
export const reqUpdateTrademark = (object: Record) =>
  request.put<any, UpdateTrademarkResponseType>(API.UPDATETRADEMARK_URL, object)
//删除品牌
export const reqDeleteTrademark = (id: number) =>
  request.delete<any, DeleteTrademarkResponseType>(
    API.DELETETRADEMARK_URL + `/${id}`,
  )
